package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsFeedbackMapper;
import com.qf.pojo.DtsFeedback;
import com.qf.service.DtsFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @version 1.0
 * @auther Administrator
 * @date 2023/2/24 15:50
 */
@Service
public class DtsFeedbackServiceImpl implements DtsFeedbackService {
    @Autowired
    private DtsFeedbackMapper dtsFeedbackMapper;

    @Override
    public IPage<DtsFeedback> findRolePageByQuery(Integer userId, String username, String sort, String order, Integer page, Integer limit) {
        return dtsFeedbackMapper.selectPage(new Page(page,limit),
                new QueryWrapper<DtsFeedback>()
                        .likeRight(!StringUtils.isEmpty(userId),"user_id",userId)
                        .like(!StringUtils.isEmpty(username),"username",username)
                        .orderBy(!StringUtils.isEmpty(sort),"ASC".equalsIgnoreCase(order),sort));
    }
}
